#ifndef _DRIAPP_H_H_
#define _DRIAPP_H_H_

#include <windows.h>
#include <vector>

using namespace std;

#include "ONEGAME.h"
#include "RSKEY.h"

class DRIAPP
{
public:
	DRIAPP();
	~DRIAPP();

	void Run(UINT id);
	void Download(UINT id);
	bool Close(UINT id);
	bool Delete(UINT id);
	bool Exist(UINT id);
	bool CloseAll();
	
	void MountRealDisk(char remoteLetter);
	void MountServerDisk(UINT id);
	void MountLocalDisk(UINT id);
	
	void SetPriRead(UINT id,bool priRead);
	void GetPriRead(UINT id,bool &priRead);
	
	UINT GetSpeed(UINT id);
	void GetGameName(UINT id,string &name);
	LONGLONG GetInitSize(UINT id);
	LONGLONG GetFinishSize(UINT id);
	LONGLONG GetTotalSize(UINT id);

private:
	vector<ONEGAME *> m_gameList;
	CRITICAL_SECTION m_cs;
	SOCKET m_sockSrv;
	HANDLE m_hSrvThread;
	/*RSKEY m_rskey;*/

	int GetGameIndex(UINT id);
	static DWORD WINAPI SrvThread(PVOID pvoid);
};

#endif
